//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.controller
{
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
	
	import reader.core.ReaderModelLocator;
	import reader.view.ApplicationMediator;

	public class LoginCommand extends SimpleCommand implements ICommand
	{
		////////////////////////////////////////////////////////////////////////////////
		//private variables
		private var airReader:Reader;
		private var readerModelLocator:ReaderModelLocator = ReaderModelLocator.instance;
		
		//////////////////////////////////////////////////////////////////////////////
		//methods
		
		override public function execute(notification:INotification):void
		{
			airReader = notification.getBody() as Reader;
			
			facade.registerProxy(readerModelLocator.sqliteProxyFactory.userProxy);
			facade.registerProxy(readerModelLocator.sqliteProxyFactory.serviceProxy);
			facade.registerMediator(new ApplicationMediator(airReader));
		}
		
	}
}